'use strict'

const BaseController  = require('./base');

class CommentController extends BaseController {
    // 根据文章获取评论
    async getCommentByArticle(){
        const data  = await this.ctx.service.comment.getCommentByArticle(this.ctx.request.body)
        this.success(data)
    }
    // 根据评论 id 获取回复列表
    async getReplyByComment(){
        const data  = await this.ctx.service.comment.getReplyByComment(this.ctx.request.body)
        this.success(data)
    }
    // 发表评论
    async createComment(){
        const data  = await this.ctx.service.comment.createComment(this.ctx.request.body)
        this.success(data)
    }
    
    // 删除评论
    async deleteComment(){
        const data  = await this.ctx.service.comment.deleteComment(this.ctx.request.body)
        this.success(data)
    }
}

module.exports = CommentController;